package j20251011;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Demo3 {
    public static void main(String[] args) throws IOException {
        try(InputStream inputStream=new FileInputStream("j20251117/test.txt")){
            //读文件操作
            while (true){
//                int data=inputStream.read();
//                if(data==-1){
//                    //读取完毕
//                    break;
//                }
//                System.out.printf("Ox%x\n",data);
                byte[] data=new byte[8];
                int n=inputStream.read(data);
                if(n==-1){
                    break;
                }
                for(int i=0;i<n;i++){
                    System.out.printf("Ox%x ",data[i]);
                }

            }
        }
    }
}
